/**
 * 说明：
 * 创建人：pluto
 * 创建时间：2018/8/3
 */
var LoginCtrl = function ($scope, $state, LoginService) {
    $scope.user = {};
    $scope.submit = function () {
        console.log($scope.user);
        LoginService.login($scope.user).then(function (res) {
            console.log(res);
            sessionStorage.setItem("token", res.token);
            sessionStorage.setItem("user", JSON.stringify(res.userInfo));
            $state.go("main.home");
        }, function (err) {
            layer.msg(err.message,{icon: 2});
        });
    }
};
angular.module('app.login.controller',[]).controller('LoginCtrl', LoginCtrl);